home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: replyDiskMessage.c,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:56:07 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
- #include "sysdefs.h"
- #include "ess.h"
- #include "checking.h"
- #include "trace.h"
- #include "error.h"
- #include "list.h"
- #include "tid.h"
- #include "io.h"
- #include "lock.h"
- #include "object.h"
- #include "msgdefs.h"
- #include "disk.h"
- #include "sharedmem_globals.h"
- #include "volume.h"
- #include "disk_funcs.h"
-
- #include "queues.h"
- #include "diskproc_globals.h"
- #include "diskproc_intfuncs.h"
- #include "diskproc_extfuncs.h"
-
- extern int Socket;
- extern struct iovec iov[];
-
- extern QUEUEPAIR *DiskQueue;
-
- void
- replyDiskMessage (
-
- DISKMSG *message
- )
- {
- #ifdef DISKPROC_MAKE
- int bytes;
-
- TRACE(TR_DISKRW, TR_LEVEL_1);
-
- {
- int blocked;
-
- getMutex(&(DiskQueue->fromDisk.mutex));
- enq_from(DiskQueue, ShmAddressToOffset(message));
- giveMutex(&(DiskQueue->fromDisk.mutex));
-
- /*
- * Don't normally need to signal the server- it'll check the queue.
- * It never waits on a semaphore, but it does select().
- * We could just check to see if we're putting this on an empty
- * queue, and if so, send our volume number to the socket (kick
- * the server).
- * But that's not quite good enough - we really need to know if
- * the server is going to block on select before it checks
- * this queue. Replies->willBlock means that it will.
- * See disk/selectDisk.c
- */
- /* Since we never set it, this doesn't need to be a critical
- * section, so no need for getMutex(Replies); giveMutex(Replies);
- */
- blocked = Replies->willBlock;
-
- /*
- * We could have blocked==FALSE and server could now decide
- * to block, and we wouldn't do the kick (below).
- * That's ok because we already put the item on the q, and
- * so the server would find it there.
- * We could also have blocked = TRUE and server could now
- * return from select, and we'd have done a superfluous kick,
- * but that's ok because the server throws away the extra kick.
- */
- if(blocked) {
-
- TRPRINT(TR_DISKRW, TR_LEVEL_1,
- ("Disk %d: KICKING server", SemNum));
-
- if((bytes = write(Socket, &SemNum, sizeof(SemNum)))<0) {
- SM_ERROR(TYPE_FATAL, errno);
- }
- } else {
- TRPRINT(TR_DISKRW, TR_LEVEL_1, ("Disk %d: server ISN'T BLOCKED"));
- }
- }
-
- #else DISKPROC_MAKE
- For use with the server process "fast" path: do nothing
- This never really gets compiled... there is an empty
- function like this in serverlib/disk/.
- That is the one that gets compiled w/o DISKPROC_MAKE.
- #endif DISKPROC_MAKE
- }
-
-